/**
 * 管理初始化
 */

Grid.controllerName = "/attendance/overtime/verify";
Grid.title = "加班审核";
Grid.PrimaryKey = "otId";
Grid.height="550px";
//Grid.id = "holidayTable";


/**
 * 初始化表格的列
 */
Grid.initColumn = function () {
    var columns = [
        {field: 'selectItem', radio: true},
        {title: 'id', field: 'otId', visible: false, align: 'center', valign: 'middle'},
        {title: '开始时间', field: 'otStrDate', align: 'center', valign: 'middle', sortable: true},
        {title: '结束时间', field: 'otEndDate', align: 'center', valign: 'middle', sortable: true},
        {title: '员工', field: 'otUserName', align: 'center', valign: 'middle', sortable: true},
        {title: '状态', field: 'otStateName', align: 'center', valign: 'middle', sortable: true},
        {title: '加班原因', field: 'otMemo', align: 'center', valign: 'middle', sortable: true}
    ];
    return columns;
};

Grid.openVerity = function(){
    if (this.check()) {
        var Id = this.seItem[Grid.PrimaryKey];
        var index = layer.open({
            type: 2,
            title: Grid.title,
            area: [Grid.width, Grid.height], //宽高
            fix: false, //不固定
            maxmin: true,
            content: Common.ctxPath + Grid.controllerName + '/to_verify/' + Id
        });
        this.layerIndex = index;
    }

}

/**
 * 查询列表
 */
Grid.search = function () {
    var queryData = {};
    queryData['state'] = $("#state").val();
    queryData['beginTime'] = $("#beginTime").val();
    queryData['endTime'] = $("#endTime").val();
    Grid.table.refresh({query: queryData});
};


$(function () {
    var defaultColunms = Grid.initColumn();
    var table = new BSTable(Grid.id, Grid.controllerName+"/list", defaultColunms);
    table.setPaginationType("server");
    Grid.table = table.init();

});